package com.wgchao.mdmp.common.http;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.arronlong.httpclientutil.common.HttpResult;
import com.wgchao.mdmp.common.ResultCommon;
import com.wgchao.mdmp.mapstruct.dto.MdmpGrxxDTO;

/**
 * @作者：wgchao
 * @时间：17:57 2019/8/18 0018
 * @用途：HttpClientUtil测试类
 **/
public class HttpTest {


    public static void main(String args[]) throws Exception{
        //测试用例
        try {
            String url = "http://127.0.0.1:8086/patient/manager/search/37028419587458425";

            HttpConfigParam httpConfigParam = HttpConfigParam.instanceOfGet(url);
            HttpResult respResult = HttpClientUtil.doHttp(httpConfigParam);
            ResultCommon<MdmpGrxxDTO> result = JSONObject.parseObject(respResult.getResult(), ResultCommon.class);
            if(result.getCode().equals("200")){
                System.out.println(JSON.toJSONString(result.getData()));
            }else{
                throw new Exception("获取患者信息失败");
            }
        }catch (Exception ex){
      //      logger.error(ex.getMessage());
            throw new Exception("获取患者信息失败");
        }
    }
}
